package org.jeecg.jxc.base.goods.service.impl;

import org.jeecg.jxc.base.goods.entity.Goods;
import org.jeecg.jxc.base.goods.entity.GoodsType;
import org.jeecg.jxc.base.goods.mapper.GoodsTypeMapper;
import org.jeecg.jxc.base.goods.service.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author : luojin
 * @date : 2022/4/27 9:28
 */
@Service
public class GoodsTypeServiceImpl implements GoodsTypeService {
    @Resource
    private GoodsTypeMapper goodsTypeMapper;
    @Override
    public boolean save(String goodsTypeName, Integer pId) {
        GoodsType goodsType = new GoodsType();
        goodsType.setGoodsTypeId(null);
        goodsType.setGoodsTypeName(goodsTypeName);
        goodsType.setGoodsTypeId(pId);
        int insert = goodsTypeMapper.insert(goodsType);
        return insert>0?true:false;
    }

    @Override
    public boolean delGoodsType(Integer goodsTypeId) {
        int i = goodsTypeMapper.deleteByPrimaryKey(goodsTypeId);
        return i>0?true:false;
    }


}
